#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: title018.py 
@version:
@time: 2023/05/14
https://leetcode.cn/problems/maximum-nesting-depth-of-the-parentheses/
"""


class Solution:
    def maxDepth(self, s: str) -> int:
        ans = cur = 0
        for c in s:
            if c == '(':
                cur += 1
                ans = max(cur, ans)
            elif c == ')':
                cur -= 1
        return ans


assert Solution().maxDepth('(1)+((2))') == 2
print('测试通过')
